<template>
  <div class="order_mian">
    <div class="order_row">
      <div class="order_wrap">
 
        <div class="order_table">
                 <div>
          <el-breadcrumb separator=">">
            <el-breadcrumb-item :to="{ path: '/home' }"
              >首页</el-breadcrumb-item
            >
            <el-breadcrumb-item v-if="!pathTo" :to="{ path: '/order' }"
              >订单中心</el-breadcrumb-item
            >
             <el-breadcrumb-item v-else-if="pathTo" :to="{ path: '/applyRecord' }"
              >报馆记录</el-breadcrumb-item
            >
            <el-breadcrumb-item>订单详情</el-breadcrumb-item>
          </el-breadcrumb>
        </div>
          <el-descriptions class="margin-top" :column="2" border>
            <el-descriptions-item>
              <template slot="label"> 展会名称： </template>
              {{ stam.exhibitionName }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 搭建商名称： </template>
              {{ stam.exhibitionCompany }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 展位名称： </template>
              {{ stam.standName }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 联系人： </template>
              {{ formInline.linkName }}
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label"> 展馆号： </template>
              {{ stam.exNumber }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 联系方式： </template>
              {{ formInline.linkPhone }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 展位号： </template>
              {{ stam.standNum }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 订单编号： </template>
              {{ formInline.orderNum }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 展位面积： </template>
              {{ stam.standArea }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 订单日期： </template>
              {{ formInline.orderTime }}
            </el-descriptions-item>
          </el-descriptions>
          <div class="contacts_ceten">
            <div class="contactsdata">服务项目</div>
            <div class="contacts_form">
              <el-table :data="formInline.fixedGoodsItem" style="width: 100%">
                <el-table-column prop="goodsName" label="项目名称">
                </el-table-column>
                <el-table-column prop="sizeName" label="规格">
                </el-table-column>
                <el-table-column prop="sellingPrice" label="单价">
                </el-table-column>
                <el-table-column prop="goodsCount" label="数量">
                </el-table-column>
    <!--            <el-table-column-->
    <!--              prop="sellingGuarantee"-->
    <!--              label="商品保证金单价"-->
    <!--            ></el-table-column>-->
                <el-table-column label="金额">
                  <template slot-scope="scope">
                    {{ scope.row.sellingPrice * scope.row.goodsCount }}
                  </template>
                </el-table-column>
              </el-table>
            </div>
          <div class="contacts_ceten">
          <div class="contactsdata">保证金</div>
          <div class="contacts_form">
            <el-table :data="formInline.guarateeGoodsItem" style="width: 100%">
              <el-table-column prop="goodsName" label="项目名称">
              </el-table-column>
              <el-table-column prop="sizeName" label="规格">
              </el-table-column>
              <el-table-column prop="sellingGuarantee" label="单价">
              </el-table-column>
              <el-table-column prop="goodsCount" label="商品数量">
              </el-table-column>
  <!--            <el-table-column-->
  <!--                    prop="sellingGuarantee"-->
  <!--                    label="商品保证金单价"-->
  <!--            ></el-table-column>-->
              <el-table-column label="金额">
                <template slot-scope="scope">
                  {{ scope.row.sellingGuarantee * scope.row.goodsCount }}
                </template>
              </el-table-column>
            </el-table>
          </div>
          </div>
            <div class="contacts_ceten">
              <div class="contactsdata">扣款项</div>
              <div class="contacts_form">
                <el-table :data="formInline.deductionList" style="width: 100%">
                  <el-table-column prop="goodsName" label="扣款原因">
                  </el-table-column>
                  <el-table-column prop="sizeName" label="规格">
                  </el-table-column>
                  <el-table-column prop="sellingGuarantee" label="单价">
                  </el-table-column>
                  <el-table-column prop="goodsCount" label="数量">
                  </el-table-column>
                  <!--            <el-table-column-->
                  <!--                    prop="sellingGuarantee"-->
                  <!--                    label="商品保证金单价"-->
                  <!--            ></el-table-column>-->
                  <el-table-column label="金额">
                    <template slot-scope="scope">
                      {{ scope.row.sellingGuarantee * scope.row.goodsCount }}
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
        </div>
          <div class="liqui_foot">
            <div class="liqui_dation">
              <div>服务项目合计:</div>
              <div class="loqui_dation_text">{{ formInline.userfeeTotal }}元</div>
            </div>
            <div class="liqui_dation">
              <div>押金总计:</div>
              <div class="loqui_dation_text">{{ formInline.guaranteeTotal }}元</div>
            </div>
            <div class="liqui_dation">
              <div>扣款总计:</div>
              <div class="loqui_dation_text">{{ formInline.deduction }}元</div>
            </div>
            <div class="liqui_dation">
              <div>订单总计:</div>
              <div class="loqui_dation_text">{{ formInline.orderAmount }}元</div>
            </div>
          </div>
          <el-descriptions direction="vertical" class="margin-top" :column="2" border>
            <el-descriptions-item>
              <template slot="label"> 开户单位： </template>
              {{blankdata.openCompany}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 开户行： </template>
              {{blankdata.openBank}}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 银行账户： </template>
              {{blankdata.account}}
            </el-descriptions-item>
<!--            <el-descriptions-item>-->
<!--              <template slot="label"> 银行代码： </template>-->
<!--              {{blankdata.account}}-->
<!--            </el-descriptions-item>-->
            <!-- <el-descriptions-item>
              <template slot="label"> 付款识别码 </template>
              <span style="color: #ff0000">6F128046</span>
            </el-descriptions-item> -->
          </el-descriptions>
          <el-collapse v-model="activeNames">
            <el-collapse-item title="注意事项" name="1">
                <div>1、如以上信息正确，汇款时请注明展会名称、展馆及展位号，以便查询；</div>
              <div>2、如以个人名义汇款，未标明以上信息，因此不能查明汇款来源，我司将其列为未付款项，付款人将付一切相关责任。</div>

            </el-collapse-item>
            <el-collapse-item title="流程" name="1">
              <!-- <el-steps :active="1" simple>
                <el-step title="报馆订单查询" icon="el-icon-search"></el-step>
                <el-step title="商品订单" icon="el-icon-edit"></el-step>
                <el-step title="上传付款凭证" icon="el-icon-picture"></el-step>
                <el-step title="提交开票资料" icon="el-icon-upload"></el-step>
              </el-steps> -->
              <div class="steps_mian">
                <div class="steps_item">
                  <div class="steps_item_text">第一步</div>
                  <div class="steps_item_text">报馆订单查询</div>
                </div>
                <div class="steps_item">
                   <div class="steps_item_text">第二步</div>
                  <div class="steps_item_text">商品订单</div>
                </div>
                <div class="steps_item">
                   <div class="steps_item_text">第三步</div>
                  <div class="steps_item_text">上传付款凭证</div>
                </div>
                <div class="steps_item">
                   <div class="steps_item_text">第四步</div>
                  <div class="steps_item_text">提交开票资料</div>
                </div>
              </div>
            </el-collapse-item>
          </el-collapse>
          <!-- <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.page"
            :limit.sync="queryParams.pageSize"
            @pagination="getlist"
          /> -->
            <div class="order_foot_but">
            <el-button @click="dowin" type="primary">下载购物清单</el-button>
            <el-button v-if="formInline.checkStatus == 1"  @click="open = true">查看及上传缴费凭证</el-button>
          </div>
        </div>
        <el-dialog title="上传缴费凭证" :visible.sync="open" width="600px" append-to-body>
          <el-form ref="form" :model="form">
            <el-form-item label="缴费凭证：" prop="paymentUrl">
              <order-image-upload v-model="form.paymentUrl"></order-image-upload>
            </el-form-item>
          </el-form>
          <el-button type="primary" @click="uploadForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </el-dialog>
      </div>
    </div>
  </div>
</template>
<script>
import { getdeilts, getdowin, updateOrder } from "@/api/order.js";
import { getToken } from "@/utils/auth";
import { bankInfo } from "@/api/lease/index.js"
import { getStandInfo } from  "@/api/outfit/drawingadd.js";
import {download} from "@/plugins/lsqdownload.js";
import {
  stand_info,
} from "@/api/outfit/drawingadd.js";
export default {
  data() {
    return {
      form: {
        orderId: null,
        paymentUrl: null,
      },
      formInline: {},
      limit: null,
      queryParams: {
        page: 1,
        pageSize: 10,
      },
      total: 10,
      fixedGoodsItem:[],
      guarateeGoodsItem:[],
      stam: {},
      blankdata: {},
      activeNames: ['1'],
      open: false,
      imgUrl: null,
      pathTo:false,
    };
  },
  // activated() {
  //   this.blankdata= {}
  //    this.formInline= {}
  //    this.stam={}
  //   let id = this.$route.query.id;
  //   this.pathTo = this.$route.query.to
  //   //this.open = this.$route.query.open
  //   if (id) {
  //     this.getlist(id);
  //   }
  //   //this.getdata();
  //   this.$emit("hldanpath", 2);
  // },
  created(){
     this.blankdata= {}
      this.stam={}
     this.formInline= {}
    let id = this.$route.query.id;
    this.pathTo = this.$route.query.to
    if (id) {
      this.getlist(id);
    }
    this.$emit("hldanpath", 2);
  },
  methods: {
    // 获取详情数据
    getlist(id) {
      getdeilts(id).then((res) => {
        if (res.code == 200) {
          this.formInline = res.data;
          console.log(this.formInline );
          this.form.paymentUrl = res.data.paymentUrl;
          getStandInfo(this.formInline.standNum).then((res) => {
            if(res.code== 200){
              this.stam = res.data;
              console.log(this.stam);
              this.getdata();
            }
            
          });
        }
      });
    },
    uploadForm() {
      this.form.orderId = this.formInline.orderId;
      this.form.submitStatus = 1;
      updateOrder(this.form).then(() => {
          this.open = false;
          if (this.form.paymentUrl != null && this.form.paymentUrl != '') {

          }
        if (this.stam.stage < 3) {
          let form = {
            id: this.stam.id,
            stage: 3,
          }
          stand_info(form);
        }

      })
    },
    // 下载购物清单
    dowin() {
      // getdowin(this.formInline.orderId).then((res) => {
      //   //console.log(res);
      //   download(res, 'application/pdf;charset=UTF-8', '订单明细' + '.pdf')
      // });
      this.$download.downVoice(this.formInline.orderId)
    },
    getdata() {
      bankInfo(this.stam.exhibitionId).then((res) => {
        if(res.code ==200) {
          if(res.rows.length > 0){
            this.blankdata = res.rows[0]
          }
         
        }
      });
    },
    cancel() {
      this.open = false;
    }
  },
};
</script>
<style scoped>
.order_mian {
  background-color: #f2f2f2;
}
.order_row {
  padding: 40px;
}
.order_wrap {
  min-width: 1000px;
  margin: auto;
}
.el-breadcrumb {
  font-size: 18px;
}
.order_table {
  width: 1150px;
  margin: auto;
  background-color: #fff;
  padding: 40px;
  margin-bottom: 30px;
}
/deep/.el-table th.el-table__cell {
  background-color: #e4fafa !important;
  text-align: center !important;
}
/deep/.el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  text-align: center !important;
}
.tale_header_text {
  font-size: 16px;
  font-weight: bold;
}
.order_table_header {
  display: flex;
  justify-content: space-between;
}
.order_foot {
  margin-top: 20px;
  font-size: 15px;
  color: #666;
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #d4d4d4;
}
.order_foot_item {
  width: 25%;
  margin-bottom: 20px;
}
.order_foot_but {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
.contacts_ceten {
  padding: 20px 0;
}
.contactsdata {
  font-size: 20px;
}
.liqui_foot {
  margin-top: 20px;
}
.liqui_dation {
  display: flex;
  justify-content: flex-end;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}
.loqui_dation_text {
  margin-left: 20px;
  color: #ff0000;
}
/deep/ el-collapse .el-collapse-item_header{
  font-size: 20px;
  font-weight: 700;
}
.steps_mian {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.steps_item {
  width: 200px;
  height: 80px;
  border: 2px solid #f6cd30;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.steps_item_text {
  font-weight: bold;
  text-align: center;
  font-size: 18px;
}
</style>